package cn.yuanqiao.archive.management.domain;

import cn.yuanqiao.common.annotation.Excel;
import cn.yuanqiao.common.exception.ServiceException;
import cn.yuanqiao.common.utils.StringUtils;
import cn.yuanqiao.common.core.domain.BaseEntity;
import cn.yuanqiao.common.utils.SecurityUtils;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 组盘记录对象 YQZPJL
 * 
 * @author sy
 * @date 2023-07-12
 */
public class YqZpjl extends BaseEntity implements Serializable
{
    private static final long serialVersionUID = 1L;

    private final String BIGTABLENAME = "_YQZPJL";

    public YqZpjl() {
        String userCode = SecurityUtils.getTenantCode();
        if(StringUtils.isEmpty(userCode)){
            throw new ServiceException("TenantCode is null");
//            this.tableName = "YQZPJL";
        }else {
            this.tableName = userCode.toUpperCase()+BIGTABLENAME;
//            this.tableName = "YQZPJL";
        }
    }

    private String tableName;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    /** 组盘记录ID */
    private Long zpjlId;

    /** 载体ID */
    @Excel(name = "载体ID")
    private Long ztId;

    /** 盘规格表ID */
    @Excel(name = "盘规格表ID")
    private Long pggId;

    /** 盘规格表组盘名称 */
    @Excel(name = "组盘名称")
    private String pggName;

    /** 组盘规则ID */
    @Excel(name = "组盘规则ID")
    private Long zpgzId;

    /** 盘号 */
    @Excel(name = "盘号")
    private String ph;

    /** 总量 */
    @Excel(name = "总量")
    private String zl;

    /** 总条数 */
    @Excel(name = "总条数")
    private String zts;

    /** 是否删除 */
    @Excel(name = "是否删除")
    private Integer isDel;

    /** 是否删除 */
    @Excel(name = "是否最新")
    private Integer isLast;

    private String errorMsg;

    /** 格式转换后的总量 */
    private String zlConvert;

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((zpjlId == null) ? 0 : zpjlId.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        YqZpjl other = (YqZpjl) obj;
        if (zpjlId == null) {
            if (other.zpjlId != null)
                return false;
        } else if (!zpjlId.equals(other.zpjlId))
            return false;
        if (ztId == null) {
            if (other.ztId != null)
                return false;
        } else if (!ztId.equals(other.ztId))
            return false;
        if (pggId == null) {
            if (other.pggId != null)
                return false;
        } else if (!pggId.equals(other.pggId))
            return false;
        if (pggName == null) {
            if (other.pggName != null)
                return false;
        } else if (!pggName.equals(other.pggName))
            return false;
        if (zpgzId == null) {
            if (other.zpgzId != null)
                return false;
        } else if (!zpgzId.equals(other.zpgzId))
            return false;
        if (ph == null) {
            if (other.ph != null)
                return false;
        } else if (!ph.equals(other.ph))
            return false;
        if (zl == null) {
            if (other.zl != null)
                return false;
        } else if (!zl.equals(other.zl))
            return false;
        if (zts == null) {
            if (other.zts != null)
                return false;
        } else if (!zts.equals(other.zts))
            return false;
        if (isDel == null) {
            if (other.isDel != null)
                return false;
        } else if (!isDel.equals(other.isDel))
            return false;
        return true;
    }

    public void setZpjlId(Long zpjlId) 
    {
        this.zpjlId = zpjlId;
    }

    public Long getZpjlId() 
    {
        return zpjlId;
    }
    public void setZtId(Long ztId) 
    {
        this.ztId = ztId;
    }

    public Long getZtId() 
    {
        return ztId;
    }
    public void setPggId(Long pggId) 
    {
        this.pggId = pggId;
    }

    public Long getPggId() 
    {
        return pggId;
    }

    public String getPggName() {
        return pggName;
    }

    public void setPggName(String pggName) {
        this.pggName = pggName;
    }

    public void setZpgzId(Long zpgzId)
    {
        this.zpgzId = zpgzId;
    }

    public Long getZpgzId() 
    {
        return zpgzId;
    }
    public void setPh(String ph) 
    {
        this.ph = ph;
    }

    public String getPh() 
    {
        return ph;
    }
    public void setZl(String zl) 
    {
        this.zl = zl;
    }

    public String getZl()
    {
        return zl;
    }
    public void setZts(String zts) 
    {
        this.zts = zts;
    }

    public String getZts() 
    {
        return zts;
    }
    public void setIsDel(Integer isDel) 
    {
        this.isDel = isDel;
    }

    public Integer getIsDel() 
    {
        return isDel;
    }

    public Integer getIsLast() {
        return isLast;
    }

    public void setIsLast(Integer isLast) {
        this.isLast = isLast;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getZlConvert() {
        return zlConvert;
    }

    public void setZlConvert(String zlConvert) {
        this.zlConvert = zlConvert;
    }

    @Override
    public String toString() {
        Map<String, Object> map = new HashMap<>();
        map.put("zpjlId", zpjlId);
        map.put("ztId", ztId);
        map.put("pggId", pggId);
        map.put("pggName", pggName);
        map.put("zpgzId", zpgzId);
        map.put("ph", ph);
        map.put("zl", zl);
        map.put("zlConvert",zlConvert);
        map.put("zts", zts);
        map.put("isDel", isDel);
        return map.toString();
    }

    //    @Override
//    public String toString() {
//        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
//            .append("zpjlId", getZpjlId())
//            .append("ztId", getZtId())
//            .append("pggId", getPggId())
//            .append("pggName",getPggName())
//            .append("zpgzId", getZpgzId())
//            .append("ph", getPh())
//            .append("zl", getZl())
//            .append("zts", getZts())
//            .append("isDel", getIsDel())
//            .toString();
//    }
}
